# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.676.14.13 -> 1.676.14.14 # include/linux/acpi.h 1.6.1.1 -> 1.6.1.2 # drivers/acpi/hardware/hwacpi.c 1.6.1.1 -> 1.6.1.2 # drivers/acpi/pci_root.c 1.1 -> 1.2 # drivers/acpi/executer/exconvrt.c 1.5.1.1 -> 1.5.1.2 # drivers/acpi/system.c 1.1 -> 1.2 # drivers/acpi/osl.c 1.1 -> 1.2 # drivers/acpi/events/evevent.c 1.6.1.3 -> 1.6.1.4 # drivers/acpi/executer/exmisc.c 1.5.1.1 -> 1.5.1.2 # drivers/acpi/acpi_ksyms.c 1.10.1.1 -> 1.10.1.2 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/09/27 bjorn_helgaas@hp.com 1.676.14.14 # ACPI changes for ia64. # -------------------------------------------- # diff -Nru a/drivers/acpi/acpi_ksyms.c b/drivers/acpi/acpi_ksyms.c --- a/drivers/acpi/acpi_ksyms.c Wed Oct 8 09:07:16 2003 +++ b/drivers/acpi/acpi_ksyms.c Wed Oct 8 09:07:16 2003 @@ -85,6 +85,7 @@ EXPORT_SYMBOL(acpi_set_register); EXPORT_SYMBOL(acpi_enter_sleep_state); EXPORT_SYMBOL(acpi_get_system_info); +EXPORT_SYMBOL(acpi_walk_namespace); /* ACPI OS Services Layer (acpi_osl.c) */ diff -Nru a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c --- a/drivers/acpi/events/evevent.c Wed Oct 8 09:07:16 2003 +++ b/drivers/acpi/events/evevent.c Wed Oct 8 09:07:16 2003 @@ -330,17 +330,29 @@ * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need * to be the same size." */ - acpi_gbl_gpe_block_info[0].address_space_id = acpi_gbl_FADT->Xgpe0_blk.address_space_id; - acpi_gbl_gpe_block_info[1].address_space_id = acpi_gbl_FADT->Xgpe1_blk.address_space_id; + if ((acpi_gbl_FADT->Xgpe0_blk.register_bit_width != 0) || + (acpi_gbl_FADT->Xgpe0_blk.register_bit_offset != 0) || + (acpi_gbl_FADT->Xgpe0_blk.address != 0)) { + acpi_gbl_gpe_block_info[0].address_space_id = acpi_gbl_FADT->Xgpe0_blk.address_space_id; + acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe0_blk.register_bit_width); - acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe0_blk.register_bit_width); - acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe1_blk.register_bit_width); + if (acpi_gbl_gpe_block_info[0].register_count == 0) + acpi_gbl_gpe_block_info[0].register_count = 1; + acpi_gbl_gpe_block_info[0].block_address = &acpi_gbl_FADT->Xgpe0_blk; + acpi_gbl_gpe_block_info[0].block_base_number = 0; + } - acpi_gbl_gpe_block_info[0].block_address = &acpi_gbl_FADT->Xgpe0_blk; - acpi_gbl_gpe_block_info[1].block_address = &acpi_gbl_FADT->Xgpe1_blk; + if ((acpi_gbl_FADT->Xgpe1_blk.register_bit_width != 0) || + (acpi_gbl_FADT->Xgpe1_blk.register_bit_offset != 0) || + (acpi_gbl_FADT->Xgpe1_blk.address != 0)) { + acpi_gbl_gpe_block_info[1].address_space_id = acpi_gbl_FADT->Xgpe1_blk.address_space_id; + acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe1_blk.register_bit_width); - acpi_gbl_gpe_block_info[0].block_base_number = 0; - acpi_gbl_gpe_block_info[1].block_base_number = acpi_gbl_FADT->gpe1_base; + if (acpi_gbl_gpe_block_info[1].register_count == 0) + acpi_gbl_gpe_block_info[1].register_count = 1; + acpi_gbl_gpe_block_info[1].block_address = &acpi_gbl_FADT->Xgpe1_blk; + acpi_gbl_gpe_block_info[1].block_base_number = acpi_gbl_FADT->gpe1_base; + } acpi_gbl_gpe_register_count = acpi_gbl_gpe_block_info[0].register_count + acpi_gbl_gpe_block_info[1].register_count; diff -Nru a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c --- a/drivers/acpi/executer/exconvrt.c Wed Oct 8 09:07:16 2003 +++ b/drivers/acpi/executer/exconvrt.c Wed Oct 8 09:07:16 2003 @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconvrt - Object conversion routines - * $Revision: 35 $ + * $Revision: 36 $ * *****************************************************************************/ @@ -194,7 +194,7 @@ case ACPI_TYPE_INTEGER: /* - * Create a new Buffer + * Create a new Buffer object */ ret_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); if (!ret_desc) { @@ -203,7 +203,6 @@ /* Need enough space for one integer */ - ret_desc->buffer.length = acpi_gbl_integer_byte_width; new_buf = ACPI_MEM_CALLOCATE (acpi_gbl_integer_byte_width); if (!new_buf) { ACPI_REPORT_ERROR @@ -217,7 +216,12 @@ for (i = 0; i < acpi_gbl_integer_byte_width; i++) { new_buf[i] = (u8) (obj_desc->integer.value >> (i * 8)); } + + /* Complete buffer object initialization */ + + ret_desc->buffer.flags |= AOPOBJ_DATA_VALID; ret_desc->buffer.pointer = new_buf; + ret_desc->buffer.length = acpi_gbl_integer_byte_width; /* Return the new buffer descriptor */ diff -Nru a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c --- a/drivers/acpi/executer/exmisc.c Wed Oct 8 09:07:16 2003 +++ b/drivers/acpi/executer/exmisc.c Wed Oct 8 09:07:16 2003 @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 104 $ + * $Revision: 105 $ * *****************************************************************************/ @@ -184,9 +184,9 @@ ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer, length1); ACPI_MEMCPY (new_buf + length1, obj_desc2->buffer.pointer, length2); - /* - * Point the return object to the new buffer - */ + /* Complete the buffer object initialization */ + + return_desc->common.flags = AOPOBJ_DATA_VALID; return_desc->buffer.pointer = (u8 *) new_buf; return_desc->buffer.length = (u32) (length1 + length2); @@ -243,21 +243,22 @@ /* * There are three cases to handle: - * 1) Two Integers concatenated to produce a buffer - * 2) Two Strings concatenated to produce a string - * 3) Two Buffers concatenated to produce a buffer + * + * 1) Two Integers concatenated to produce a new Buffer + * 2) Two Strings concatenated to produce a new String + * 3) Two Buffers concatenated to produce a new Buffer */ switch (obj_desc1->common.type) { case ACPI_TYPE_INTEGER: - /* Result of two integers is a buffer */ + /* Result of two Integers is a Buffer */ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); if (!return_desc) { return (AE_NO_MEMORY); } - /* Need enough space for two integers */ + /* Need enough buffer space for two integers */ return_desc->buffer.length = acpi_gbl_integer_byte_width * 2; new_buf = ACPI_MEM_CALLOCATE (return_desc->buffer.length); @@ -268,8 +269,6 @@ goto cleanup; } - return_desc->buffer.pointer = (u8 *) new_buf; - /* Convert the first integer */ this_integer = obj_desc1->integer.value; @@ -286,11 +285,17 @@ this_integer >>= 8; } + /* Complete the buffer object initialization */ + + return_desc->common.flags = AOPOBJ_DATA_VALID; + return_desc->buffer.pointer = (u8 *) new_buf; break; case ACPI_TYPE_STRING: + /* Result of two Strings is a String */ + return_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING); if (!return_desc) { return (AE_NO_MEMORY); @@ -307,11 +312,13 @@ goto cleanup; } + /* Concatenate the strings */ + ACPI_STRCPY (new_buf, obj_desc1->string.pointer); ACPI_STRCPY (new_buf + obj_desc1->string.length, obj_desc2->string.pointer); - /* Point the return object to the new string */ + /* Complete the String object initialization */ return_desc->string.pointer = new_buf; return_desc->string.length = obj_desc1->string.length + @@ -321,7 +328,7 @@ case ACPI_TYPE_BUFFER: - /* Operand0 is a buffer */ + /* Result of two Buffers is a Buffer */ return_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); if (!return_desc) { @@ -337,22 +344,26 @@ goto cleanup; } + /* Concatenate the buffers */ + ACPI_MEMCPY (new_buf, obj_desc1->buffer.pointer, obj_desc1->buffer.length); ACPI_MEMCPY (new_buf + obj_desc1->buffer.length, obj_desc2->buffer.pointer, obj_desc2->buffer.length); - /* - * Point the return object to the new buffer - */ + /* Complete the buffer object initialization */ + return_desc->common.flags = AOPOBJ_DATA_VALID; return_desc->buffer.pointer = (u8 *) new_buf; return_desc->buffer.length = obj_desc1->buffer.length + - obj_desc2->buffer.length; + obj_desc2->buffer.length; break; default: + + /* Invalid object type, should not happen here */ + status = AE_AML_INTERNAL; return_desc = NULL; } diff -Nru a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c --- a/drivers/acpi/hardware/hwacpi.c Wed Oct 8 09:07:16 2003 +++ b/drivers/acpi/hardware/hwacpi.c Wed Oct 8 09:07:16 2003 @@ -91,33 +91,44 @@ { acpi_status status; - u32 retry; + u32 retry; ACPI_FUNCTION_TRACE ("Hw_set_mode"); + + if (mode == acpi_hw_get_mode()) + return_ACPI_STATUS (AE_OK); + + /* If no SMI_CMD, system does not support SMI */ + if (!acpi_gbl_FADT->smi_cmd) + return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); + switch (mode) { case ACPI_SYS_MODE_ACPI: /* BIOS should have disabled ALL fixed and GP events */ status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, - (acpi_integer) acpi_gbl_FADT->acpi_enable, 8); + (acpi_integer) acpi_gbl_FADT->acpi_enable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); break; case ACPI_SYS_MODE_LEGACY: + /* If both enable/disable are zero, legacy mode is not supported */ + if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) + return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); + /* * BIOS should clear all fixed status bits and restore fixed event * enable bits to default */ status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, - (acpi_integer) acpi_gbl_FADT->acpi_disable, 8); + (acpi_integer) acpi_gbl_FADT->acpi_disable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable Legacy (non-ACPI) mode\n")); break; - default: return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -178,6 +189,18 @@ return_VALUE (ACPI_SYS_MODE_ACPI); } else { +#ifdef CONFIG_IA64_HP_PROTO + /* + * If enable/disable are zero, the system doesn't support + * legacy mode, so the SCI_EN is wrong. + */ + if (!acpi_gbl_FADT->acpi_enable && + !acpi_gbl_FADT->acpi_disable) { + printk("Warning: Ignoring bogus SCI_EN value\n"); + return_VALUE (ACPI_SYS_MODE_ACPI); + } +#endif + return_VALUE (ACPI_SYS_MODE_LEGACY); } } diff -Nru a/drivers/acpi/osl.c b/drivers/acpi/osl.c --- a/drivers/acpi/osl.c Wed Oct 8 09:07:16 2003 +++ b/drivers/acpi/osl.c Wed Oct 8 09:07:16 2003 @@ -1,5 +1,5 @@ /* - * acpi_osl.c - OS-dependent functions ($Revision: 75 $) + * acpi_osl.c - OS-dependent functions ($Revision: 1.2 $) * * Copyright (C) 2000 Andrew Henroid * Copyright (C) 2001, 2002 Andy Grover @@ -37,15 +37,10 @@ #include "acpi.h" #ifdef CONFIG_ACPI_EFI -#include +#include u64 efi_mem_attributes (u64 phys_addr); #endif -#ifdef _IA64 -#include -#include -#endif - #define _COMPONENT ACPI_OS_SERVICES ACPI_MODULE_NAME ("osl") @@ -176,10 +171,10 @@ acpi_os_map_memory(ACPI_PHYSICAL_ADDRESS phys, ACPI_SIZE size, void **virt) { #ifdef CONFIG_ACPI_EFI - if (EFI_MEMORY_UC & efi_mem_attributes(phys)) { - *virt = ioremap(phys, size); - } else { + if (EFI_MEMORY_WB & efi_mem_attributes(phys)) { *virt = phys_to_virt(phys); + } else { + *virt = ioremap(phys, size); } #else if (phys > ULONG_MAX) { @@ -234,9 +229,16 @@ acpi_status acpi_os_install_interrupt_handler(u32 irq, OSD_HANDLER handler, void *context) { -#ifdef _IA64 - irq = isa_irq_to_vector(irq); -#endif /*_IA64*/ +#ifdef CONFIG_IA64 + int vector; + + vector = acpi_irq_to_vector(irq); + if (vector < 0) { + printk(KERN_ERR PREFIX "SCI (IRQ%d) not registerd\n", irq); + return AE_OK; + } + irq = vector; +#endif acpi_irq_irq = irq; acpi_irq_handler = handler; acpi_irq_context = context; @@ -252,9 +254,9 @@ acpi_os_remove_interrupt_handler(u32 irq, OSD_HANDLER handler) { if (acpi_irq_handler) { -#ifdef _IA64 - irq = isa_irq_to_vector(irq); -#endif /*_IA64*/ +#ifdef CONFIG_IA64 + irq = acpi_irq_to_vector(irq); +#endif free_irq(irq, acpi_irq); acpi_irq_handler = NULL; } @@ -349,12 +351,12 @@ #ifdef CONFIG_ACPI_EFI int iomem = 0; - if (EFI_MEMORY_UC & efi_mem_attributes(phys_addr)) { + if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) { + virt_addr = phys_to_virt(phys_addr); + } else { iomem = 1; virt_addr = ioremap(phys_addr, width); - } - else - virt_addr = phys_to_virt(phys_addr); + } #else virt_addr = phys_to_virt(phys_addr); #endif @@ -394,12 +396,12 @@ #ifdef CONFIG_ACPI_EFI int iomem = 0; - if (EFI_MEMORY_UC & efi_mem_attributes(phys_addr)) { + if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) { + virt_addr = phys_to_virt(phys_addr); + } else { iomem = 1; virt_addr = ioremap(phys_addr,width); - } - else - virt_addr = phys_to_virt(phys_addr); + } #else virt_addr = phys_to_virt(phys_addr); #endif diff -Nru a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c --- a/drivers/acpi/pci_root.c Wed Oct 8 09:07:16 2003 +++ b/drivers/acpi/pci_root.c Wed Oct 8 09:07:16 2003 @@ -103,8 +103,6 @@ switch (status) { case AE_OK: root->id.segment = (u16) value; - printk("_SEG exists! Unsupported. Abort.\n"); - BUG(); break; case AE_NOT_FOUND: ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -162,7 +160,8 @@ * PCI namespace does not get created until this call is made (and * thus the root bridge's pci_dev does not exist). */ - root->bus = pcibios_scan_root(root->id.bus); + root->bus = pcibios_scan_root(root->handle, root->id.segment, + root->id.bus); if (!root->bus) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Bus %02x:%02x not present in PCI namespace\n", diff -Nru a/drivers/acpi/system.c b/drivers/acpi/system.c --- a/drivers/acpi/system.c Wed Oct 8 09:07:16 2003 +++ b/drivers/acpi/system.c Wed Oct 8 09:07:16 2003 @@ -35,7 +35,9 @@ #include #include #include +#ifdef __i386__ #include +#endif #include "acpi_bus.h" #include "acpi_drivers.h" diff -Nru a/include/linux/acpi.h b/include/linux/acpi.h --- a/include/linux/acpi.h Wed Oct 8 09:07:16 2003 +++ b/include/linux/acpi.h Wed Oct 8 09:07:16 2003 @@ -36,6 +36,7 @@ * isn't the right answer either. Please just ignore it for now. */ #include "../../drivers/acpi/include/acpi.h" +#include "../../drivers/acpi/acpi_drivers.h" #include @@ -377,6 +378,8 @@ #ifdef CONFIG_ACPI int acpi_init(void); +acpi_status acpi_hp_csr_space(acpi_handle, u64 *base, u64 *length); +acpi_status acpi_get_addr_space(acpi_handle, u8 type, u64 *base, u64 *length, u64 *tra); #endif /*CONFIG_ACPI*/